﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace SMS.Console
{
    public partial class SelectConfigFileForm : BaseForm
    {
        public SelectConfigFileForm()
        {
            InitializeComponent();
        }

        private void btn_Browser_Click(object sender, EventArgs e)
        {
            DialogResult r = openFileDialog1.ShowDialog();
            if (r == DialogResult.OK)
            {
                txt_FilePath.Text = openFileDialog1.FileName;
            }
        }

        private void btn_Accept_Click(object sender, EventArgs e)
        {
            if (txt_FilePath.Text == string.Empty)
            {
                base.Alert("请选择配置文件。");
            }
            else
            {
                if (File.Exists(txt_FilePath.Text))
                {
                    this.DialogResult = DialogResult.OK;
                    //this.Close();
                }
                else
                {
                    base.Alert("配置文件不存在。");
                }
            }
        }

        public string FilePath
        {
            get
            {
                return txt_FilePath.Text;
            }
            set
            {
                txt_FilePath.Text = value;
            }
        }
    }
}
